package tree.test104;

import listbyorder.utils.TreeNode;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/16 11:51
 */
public class Solution1 {

    public int maxDepth(TreeNode root) {
        if (root == null) return 0;
        if (root.left == null) return maxDepth(root.right) + 1;
        if (root.right == null) return maxDepth(root.left) + 1;
        return Math.max(maxDepth(root.right), maxDepth(root.left)) + 1;
    }
}
